﻿using System;
using System.Linq;
using System.Windows.Forms;

namespace Gestión_UTN.View.main
{
    public partial class MainAdministracion : Form
    {
        public MainAdministracion()
        {
            InitializeComponent();
        }

        private void pctCarreras_Click(object sender, EventArgs e)
        {
            Form existe = Application.OpenForms.OfType<Form>().Where(pre => pre.Name == "Carreras").SingleOrDefault<Form>();

            if (existe != null)
            {

                existe.WindowState = FormWindowState.Normal;
            }
            else
            {
                general.Carreras carreras = new general.Carreras();
                carreras.StartPosition = FormStartPosition.CenterScreen;
                carreras.Show();
            }
        }

        private void pctCarreras_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Carreras";
        }

        private void pctCarreras_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Inicial";
        }

        private void pctHorario_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Horarios";
        }

        private void pctHorario_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void pctCursadas_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Cursadas";
        }

        private void pctCursadas_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void pctMaterias_Click(object sender, EventArgs e)
        {
            Form existe = Application.OpenForms.OfType<Form>().Where(pre => pre.Name == "Materias").SingleOrDefault<Form>();

            if (existe != null)
            {

                existe.WindowState = FormWindowState.Normal;
            }
            else
            {
                general.Materias materias = new general.Materias();
                materias.StartPosition = FormStartPosition.CenterScreen;
                materias.Show();
            }
        }

        private void pctMaterias_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Materias";
        }

        private void pctMaterias_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void pctFechasExamenes_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Fechas de Examenes";
        }

        private void pctFechasExamenes_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void pctFechasExamenes_Click(object sender, EventArgs e)
        {
            Form existe = Application.OpenForms.OfType<Form>().Where(pre => pre.Name == "FechasExamenes").SingleOrDefault<Form>();

            if (existe != null)
            {

                existe.WindowState = FormWindowState.Normal;
            }
            else
            {
                general.FechasExamenes examenes = new general.FechasExamenes();
                examenes.StartPosition = FormStartPosition.CenterScreen;
                examenes.Show();
            }
        }

        private void pctExamenes_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Crear Tipos de Examenes";
        }

        private void pctExamenes_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void pctExamenes_Click(object sender, EventArgs e)
        {
            Form existe = Application.OpenForms.OfType<Form>().Where(pre => pre.Name == "TipoExamen").SingleOrDefault<Form>();

            if (existe != null)
            {

                existe.WindowState = FormWindowState.Normal;
            }
            else
            {
                general.TipoExamen tipos = new general.TipoExamen();
                tipos.StartPosition = FormStartPosition.CenterScreen;
                tipos.Show();
            }
        }

        private void picUsuarios_MouseHover(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Usuarios";
        }

        private void picUsuarios_MouseLeave(object sender, EventArgs e)
        {
            this.lblStatus.Text = "Pantalla Principal";
        }

        private void picUsuarios_Click(object sender, EventArgs e)
        {
            Form existe = Application.OpenForms.OfType<Form>().Where(pre => pre.Name == "Usuarios").SingleOrDefault<Form>();

            if (existe != null)
            {

                existe.WindowState = FormWindowState.Normal;
            }
            else
            {
                general.Usuarios usuarios = new general.Usuarios();
                usuarios.StartPosition = FormStartPosition.CenterScreen;
                usuarios.Show();
            }
        }
    }
}
